<template>
  <view
    class="login_box"
    :style="{ backgroundImage: `url('${loginStyle.loginBgImage}')` }"
  >
    <view class="school_logo" :style="{ marginTop: safeAreaInsets!.top + 60 + 'px' }">
      <image v-if="loginStyle.loginLogo" :src="loginStyle.loginLogo" mode="scaleToFill" />
    </view>
    <view class="school_tips" v-if="loginStyle.loginMainHeading">欢迎进入</view>
    <view class="school_tips1" v-if="loginStyle.loginSubHeading"
      >江苏联合技术学院综合服务管理平台</view
    >
    <view class="school_tips"></view>
    <view class="school_tips1"></view>

    <view v-if="loginStyle.loginLogo" class="loginBtn_box" style="margin-top: 220rpx">
      <view class="btn_phone">
        <text class="weixin_icon iconfont icon-weixin"></text>
        <text class="weixn">微信授权登录</text>
      </view>
      <view class="btn_code" @tap="clickLogin('1')"> 手机验证码登录 </view>
      <view class="btn_user" @tap="clickLogin('2')"> 用户名登录 </view>
    </view>

    <view v-if="!loginStyle.loginLogo" class="loginBtn_box" style="margin-top: 420rpx">
      <view class="btn_phone" style="background-color: #0d80d7">
        <text class="weixin_icon iconfont icon-weixin"></text>
        <text class="weixn" style="color: #fff">微信授权登录</text>
      </view>
      <view class="btn_code hui" @tap="clickLogin('1')"> 手机验证码登录 </view>
      <view class="btn_user hui" @tap="clickLogin('2')"> 用户名登录 </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { ref } from "vue";
const { safeAreaInsets } = uni.getSystemInfoSync();
import { listconfiglogin } from "@/api/http";
const loginStyle = ref({
  loginBgImage: "",
  loginLogo: "",
  loginMainHeading: "",
  loginSubHeading: "",
});
function getConfigLogin() {
  listconfiglogin().then((res) => {
    loginStyle.value = {
      loginBgImage: res.data.loginBgImage || "",
      loginLogo: res.data.loginLogo || "",
      loginMainHeading: res.data.loginMainHeading || "",
      loginSubHeading: res.data.loginSubHeading || "",
    };
  });
}
function clickLogin(type) {
  uni.navigateTo({ url: "/pages/login_form/index?type=" + type });
}

getConfigLogin();
</script>

<style lang="scss">
page {
  overflow: hidden;
  height: 100%;
}

.hui {
  background-color: #eaeaea !important;
  color: #333 !important;
}

.login_box {
  overflow: hidden;
  height: 100%;
  // background: url(@/static/images/login_back1.png) no-repeat;
  background-repeat: no-repeat;
  background-size: 100% 100%;

  .school_logo {
    width: 180rpx;
    height: 180rpx;
    margin: 0 auto;
    border-radius: 50%;

    image {
      width: 100%;
      height: 100%;
    }
  }

  .school_tips {
    text-align: center;
    font-size: 50rpx;
    color: #fff;
    margin: 48rpx 0 20rpx 0;
  }

  .school_tips1 {
    text-align: center;
    font-size: 40rpx;
    color: #fff;
    margin: 40rpx 0 30rpx 0;
  }

  .loginBtn_box {
    // margin-top: 220rpx;
    // background-color: red;

    .btn_phone,
    .btn_code,
    .btn_user {
      width: 650rpx;
      height: 80rpx;
      background-color: #fff;
      border-radius: 42rpx;
      text-align: center;
      line-height: 80rpx;
      color: #2362a6;
      font-size: 32rpx;
      margin: 0 auto 36rpx;
      box-sizing: border-box;

      .weixin_icon {
        color: #4cbf00;
        font-size: 45rpx;
        margin-right: 10rpx;
      }
    }

    .btn_code,
    .btn_user {
      color: #fff;
      background: rgba(255, 255, 255, 0.2);
      border: 1px solid rgba(255, 255, 255, 0.45);
    }
  }
}
</style>
